package com.uzai.console.service.feign.impl;

import com.uzai.common.result.ResponseCode;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.dto.feign.redpacket.RedPacketCreateAndSendDto;
import com.uzai.console.dto.feign.redpacket.RedPacketSendByIdDto;
import com.uzai.console.dto.feign.usertakebal.CashierAppCheckDto;
import com.uzai.console.dto.feign.usertakebal.UserTakeBalQueryResultDto;
import com.uzai.console.dto.feign.usertakebal.UserTakeBalTransAccountDto;
import com.uzai.console.service.feign.RedPacketFeignService;
import com.uzai.console.service.feign.UserTakeBalFeignService;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Auther: jianghan
 * @Date: 2021/11/24 16:24
 * @Description:
 */
@Component
public class UserTakeBalFeignFallbackFactory implements FallbackFactory<UserTakeBalFeignService> {

    private static Logger logger = LoggerFactory.getLogger(UserTakeBalFeignFallbackFactory.class);

    @Override
    public UserTakeBalFeignService create(Throwable throwable) {

        logger.error("--会员提现调用微服务出错，err:={}", throwable);

        return new UserTakeBalFeignService() {
            @Override
            public UzaiRespVo<Integer> alipay(UserTakeBalTransAccountDto userTakeBalTransAccountDto) {
                UzaiRespVo<Integer> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Boolean> sendcard(UserTakeBalTransAccountDto userTakeBalTransAccountDto) {
                UzaiRespVo<Boolean> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(false);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Integer> wxpay(UserTakeBalTransAccountDto userTakeBalTransAccountDto) {
                UzaiRespVo<Integer> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Boolean> queryResult(UserTakeBalQueryResultDto userTakeBalQueryResultDto) {
                UzaiRespVo<Boolean> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(false);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Boolean> cashierAppCheck(CashierAppCheckDto cashierAppCheckDto) {
                UzaiRespVo<Boolean> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(false);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Integer> redpack(UserTakeBalTransAccountDto userTakeBalTransAccountDto) {
                UzaiRespVo<Integer> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

        };


    }

}
